package com.qsmx.store.app.main.home;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.qsmx.store.app.R;
import com.qsmx.store.app.R2;
import com.qsmx.store.app.event.HomeTitleShowEvent;
import com.qsmx.store.app.main.gift.GiftDelegate;
import com.qsmx.store.app.main.goods.GoodsDelegate;
import com.qsmx.store.app.main.mem.MemCardDelegate;
import com.qsmx.store.app.main.service.ServiceHomeDelegate;
import com.qsmx.store.app.main.suit.SuitDelegate;
import com.qsmx.store.core.delegates.AtmosDelegate;

import org.greenrobot.eventbus.EventBus;

import butterknife.OnClick;

public class HomeDelegate extends AtmosDelegate {

    @OnClick(R2.id.iv_home_mem_card)
    void onMemCard() {
        getSupportDelegate().start(new MemCardDelegate());
        Bundle bundle = new Bundle();
        bundle.putString("title", "mem_card");
        EventBus.getDefault().post(new HomeTitleShowEvent(bundle));
    }

    @OnClick(R2.id.iv_home_goods)
    void onHomeGoods() {
        getSupportDelegate().start(new GoodsDelegate());
        Bundle bundle = new Bundle();
        bundle.putString("title", "goods");
        EventBus.getDefault().post(new HomeTitleShowEvent(bundle));
    }

    @OnClick(R2.id.iv_home_machine)
    void onHomeService() {
        getSupportDelegate().start(new ServiceHomeDelegate());
        Bundle bundle = new Bundle();
        bundle.putString("title", "service");
        EventBus.getDefault().post(new HomeTitleShowEvent(bundle));
    }

    @OnClick(R2.id.iv_home_ticket)
    void onHomeCoins() {
        EventBus.getDefault().post(new HomeTitleShowEvent(new Bundle()));
    }

    @OnClick(R2.id.iv_home_coins)
    void onHomeSuit() {
        getSupportDelegate().start(new SuitDelegate());
        Bundle bundle = new Bundle();
        bundle.putString("title", "suit");
        EventBus.getDefault().post(new HomeTitleShowEvent(bundle));
    }

    @OnClick(R2.id.iv_home_gift)
    void onHomeGift() {
        Bundle bundle = new Bundle();
        bundle.putString("title", "gift");
        getSupportDelegate().start(new GiftDelegate());
        EventBus.getDefault().post(new HomeTitleShowEvent(bundle));
    }


    @Override
    public Object setLayout() {
        return R.layout.delegate_home;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {

    }
}
